<?xml version="1.0" encoding="UTF-8"?>
<% host = APIDocsView.blockscout_url(true) %>
<% date = to_string(Date.utc_today()) %>
<% non_parameterized_urls = ["/", "/txs", "/blocks", "/accounts", "/verified-contracts", "/tokens", "/apps", "/stats", "/api-docs", "/graphiql", "/search-results", "/withdrawals", "/l2-deposits", "/l2-output-roots", "/l2-txn-batches", "/l2-withdrawals"] %>
<% params = [paging_options: %PagingOptions{page_size: limit()}, necessity_by_association: %{}] %>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <%= for url <- non_parameterized_urls do %>
    <url>
      <loc><%= host %><%= url %></loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>

  <% addresses = Address.list_top_addresses(params) %>
  <%= for {address, _} <- addresses do %>
    <url>
      <loc><%= host %>/address/<%= to_string(address) %></loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>

  <% transactions = Chain.recent_transactions(params, [:validated]) %>
  <%= for transaction <- transactions do %>
    <url>
      <loc><%= host %>/tx/<%= to_string(transaction.hash) %></loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>

  <% blocks = Chain.list_blocks(params) %>
  <%= for block <- blocks do %>
    <url>
      <loc><%= host %>/block/<%= to_string(block.number) %></loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>

  <% tokens = Token.list_top(nil, params) %>
  <%= for token <- tokens do %>
    <url>
      <loc><%= host %>/token/<%= to_string(token.contract_address_hash) %></loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>

  <% smart_contracts_hashes = Chain.verified_contracts_top(limit()) %>
  <%= for hash <- smart_contracts_hashes do %>
    <url>
      <loc><%= host %>/address/<%= Address.checksum(hash) %>?tab=contract</loc>
      <lastmod><%= date %></lastmod>
    </url>
  <% end %>
</urlset>
